<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>长乐美食城后台修改密码</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="alternate icon" type="image/png" href="__PUBLIC__/vendor/assets/i/favicon.png">
    <link rel="stylesheet" href="__PUBLIC__/vendor/assets/css/amazeui.min.css"/>
    <style>
        .header {
            text-align: center;
        }

        .header h1 {
            font-size: 200%;
            color: #333;
            margin-top: 30px;
        }

        .header p {
            font-size: 14px;
        }

        .am-icon-heart {
            color: red;
        }
    </style>
</head>
<body>
<div class="header">
    <div class="am-g">
        <h1>长乐美食城</h1>
        <p>Integrated Development Environment<br/>代码编辑，代码生成，界面设计，调试，编译</p>
    </div>
    <hr/>
</div>
<div class="am-g">
    <div class="am-u-lg-6 am-u-md-8 am-u-sm-centered">
        <h3>修改密码</h3>
        <hr>
        <form class="am-form">
            <label for="password">密码:</label>
            <input type="password" id="password" placeholder="请输入新密码">
            <br>
            <label for="password">确认密码:</label>
            <input type="password" id="check_password" placeholder="请再次输入密码">
            <br>
            <div class="am-cf">
                <input type="submit" value="保 存" class="am-btn am-btn-primary am-btn-sm am-fl submit">
            </div>
        </form>
        <hr>
        <p>Copyright © 2017. Made With <i class="am-icon am-icon-heart"></i> By Holy. All
            Rights Reserved.
        </p>
    </div>
</div>

<script src="__PUBLIC__/vendor/assets/js/jquery.min.js"></script>
<script src="__PUBLIC__/vendor/assets/js/amazeui.min.js"></script>
<script>
    $(function () {
        $('.submit').click(function () {
            var info = {
                password: $("#password").val(),
                check_password: $("#check_password").val()
            };

            if (info.password.length < 6) {
                alert('密码最低6位');
                return false;
            }

            if (info.check_password.length < 6) {
                alert('确认密码最低6位');
                return false;
            }

            if (info.password != info.check_password) {
                alert('两次密码输入不一样');
                return false;
            }

            $.post("{{:U('doeditpwd')}}", info, function (data) {
                if (data.status == 1) {
                    alert(data.msg);
                    location.href = "{{:U('User/login')}}";
                } else {
                    alert(data.msg);
                }
            });
            return false;
        })
    })
</script>
</body>
</html>
